<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>父组件与子组件区别</title>
    <script src="js/vue.min.js"></script>
</head>
<body>
<div id="app">
    <cpn2></cpn2>
</div>
</body>
<script>
    //组件1
    const cpn1 = Vue.extend({
        template:`
        <div>
          <h3>标题1</h3>
          <p>组件1</p>
        </div>`
    });
    // 组件2中使用组件1
    const cpn2 = Vue.extend({
        template:`
        <div>
          <h2>标题2</h2>
          <p>组件2</p>
          <cpn1></cpn1>
        </div>`,
        components:{
            cpn1:cpn1
        }
    });

    const app = new Vue({
        el:"#app",
        components:{//局部组件
            cpn2:cpn2
        }
    })
</script>
</html>